package com.sss.hloster02;

public class SelectSort {// 简单选择排序
	public SelectSort(int a[]) {
		// int position = 0;//下标所在位置
		for (int i = 0; i < a.length - 1; i++) {// 选择最小的数和第一个数交换位置，此为第一轮
			int position = i;
			int temp =a[i] ;
			for (int j = i+1; j < a.length; j++) {
				if (a[j] <a[i]) {
					temp = a[j];
					position = j;
				}
			}
			a[position] = a[i];
			a[i] = temp;
		}
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + "   ");
		}
	}
}
